/**
 * Created with IntelliJ IDEA.
 * User: ivan
 * Date: 12-5-24
 * Time: 上午10:05
 * To change this template use File | Settings | File Templates.
 */
define(['bootstrap/bootstrap-alert'], function () {
    var obj = {};

    obj.tip = function (conf) {
        $('#' + conf.id).html('');
        var title = '警告！';

        
        var type_class = '';
        if (conf.type) {
            if (conf.type == 'error') {
                type_class = 'alert-error';
                title = '错误！';
            }
            if (conf.type == 'info') {
                type_class = 'alert-info';
                title = '提示！';
            }
        }
		
		if (conf.title)
            title = conf.title;
			
        var _html = "<div class='alert alert-block " + type_class + " fade in' id='__alert'>";
        if(conf.disableClose){

        }else{
            _html += "<a class='close' data-dismiss='alert' href='#'>×</a>";
        }
        if (type_class == 'alert-error') {
            _html += "<h4 class='alert-heading'>" + title + "</h4>";
            _html += "<p>" + conf.content + "</p>";
        } else {
            _html += "<strong>" + title + "</strong>" + conf.content;
        }
        _html += "</div>";

        $('#' + conf.id).html(_html);

        $('#__alert').alert();

    }

    return obj;
});